package com.demo.user.service.impl;

import com.demo.user.service.UserService;
import com.demo.user.dao.UserMapper;
import com.demo.user.domain.User;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @Author jianggang
 * @Date 2018/7/10.
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public PageInfo<User> findAllUser(int pageNum, int pageSize) {
        //将参数传给这个方法就可以实现物理分页了，非常简单。
        PageHelper.startPage(pageNum, pageSize);
        List<User> user = userMapper.selectAllUser();
        PageInfo result = new PageInfo(user);
        return result;
    }
}
